Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix matrix multiplication with non-commutative elements #321

Merged
merged 9 commits into from
Dec 12, 2023

Conversation

jishnub
Copy link
Member

@jishnub jishnub commented Dec 5, 2023

Fixes various issues like

julia> using FillArrays, LinearAlgebra, StaticArrays

julia> S = SMatrix{2,3}(1:6);

julia> A = reshape([S,2S,3S,4S],2,2);

julia> F = Fill(S',2,2);

julia> A * F
2×2 Matrix{SMatrix{2, 2, Int64, 4}}:
 [140 176; 176 224]  [140 176; 176 224]
 [210 264; 264 336]  [210 264; 264 336]

julia> mul!(similar(A * F), A, F)  A * F
true

This example errors on master currently as the order of terms is incorrect (assumes commutativity).

Copy link

codecov bot commented Dec 5, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (373183f) 99.89% compared to head (01b083a) 99.89%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #321      +/-   ##
==========================================
- Coverage   99.89%   99.89%   -0.01%     
==========================================
  Files           8        8              
  Lines         919      916       -3     
==========================================
- Hits          918      915       -3     
  Misses          1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jishnub jishnub marked this pull request as draft December 5, 2023 11:29
@jishnub jishnub changed the title Fix matrix multiplication with array elements Fix matrix multiplication with non-commutative elements Dec 5, 2023
@jishnub jishnub marked this pull request as ready for review December 5, 2023 14:50
@jishnub jishnub marked this pull request as ready for review December 6, 2023 07:17
@jishnub
Copy link
Member Author

jishnub commented Dec 7, 2023

This should be ready now

test/runtests.jl Outdated Show resolved Hide resolved
@jishnub
Copy link
Member Author

jishnub commented Dec 12, 2023

The coverage reduction seems spurious

@jishnub jishnub merged commit 1f72917 into JuliaArrays:master Dec 12, 2023
23 of 24 checks passed
@jishnub jishnub deleted the matmulmatrix branch December 12, 2023 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants